// Move the mouse across the screen as a sine wave.
var robot = require("robotjs");

// Speed up the mouse.
robot.setMouseDelay(2);

var twoPI = Math.PI * 2.0;

var screenSize = robot.getScreenSize();
//Gets the screen width and height.
//Returns an object with .width and .height.

var height = (screenSize.height / 2) - 10;
var width = screenSize.width;

for (var x = 0; x < width; x++)
{
  y = height * Math.sin((twoPI * x) / width) + height;
  robot.moveMouse(x, y);
  //Moves mouse to x, y instantly, with the mouse button up.
  /*
    Argument	Description	 Default
    x	 	                   None
    y	 	                   None
  */
}

//↑ 请在单独的命令行窗口运行本文件 以便你能使用 ctrl+c 终止本程序运行
